* lisp/mpc.el (mpc-volume-mouse-set): Don't burp at the boundaries.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 1 May 2014 01:08:08 +0000 (21:08 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 1 May 2014 01:08:08 +0000 (21:08 -0400)
lisp/ChangeLog
lisp/mpc.el

index 1514a5bf66475620261e6d06ea18c5a0ca0debbf..dad6d7e92b0db71813dee489968808c0a3089dd0 100644 (file)
@@ -1,3 +1,7 @@
+2014-05-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * mpc.el (mpc-volume-mouse-set): Don't burp at the boundaries.
+
 2014-04-30  Eli Zaretskii  <eliz@gnu.org>
 
        * dired.el (dired-initial-position-hook, dired-initial-position):
index d89231e81b91df7a1e9428daf8598ba362e1627c..d569610a6152c0f868f6821b0d51233645faba7b 100644 (file)
@@ -1811,9 +1811,14 @@ A value of t means the main playlist.")
                         (char-after (posn-point posn))))
                     '(?◁ ?<))
               (- mpc-volume-step) mpc-volume-step))
-         (newvol (+ (string-to-number (cdr (assq 'volume mpc-status))) diff)))
-    (mpc-proc-cmd (list "setvol" newvol) 'mpc-status-refresh)
-    (message "Set MPD volume to %s%%" newvol)))
+         (curvol (string-to-number (cdr (assq 'volume mpc-status))))
+         (newvol (max 0 (min 100 (+ curvol diff)))))
+    (if (= newvol curvol)
+        (progn
+          (message "MPD volume already at %s%%" newvol)
+          (ding))
+      (mpc-proc-cmd (list "setvol" newvol) 'mpc-status-refresh)
+      (message "Set MPD volume to %s%%" newvol))))
 
 (defun mpc-volume-widget (vol &optional size)
   (unless size (setq size 12.5))